package com.jianying.mapper;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.jianying.base.BaseMapper;
import com.jianying.dataSource.TargetDataSource;
import com.jianying.domain.Supplier;

@Repository("supplierMapper")
public class SupplierMapper extends BaseMapper {

	private static final String NAME_SPACE = "com.jianying.mapper.SupplierMapper.";
	
	@TargetDataSource(name="ds1")
	public void insert(Supplier supplier){
		getSqlSessionTemplate().insert(NAME_SPACE + "insert", supplier);
	}
	
	@TargetDataSource(name="ds1")
	public Supplier find(Integer tenantId, Integer sourceTenantId){
		Map<String, Object> map = new HashMap<>();
		map.put("tenantId", tenantId);
		map.put("sourceTenantId", sourceTenantId);
		return getSqlSessionTemplate().selectOne(NAME_SPACE + "find", map);
	}
}
